<template>
  <ul class="songList">
    <li v-for="(item, index) in songs" :key="item.id">
      <i v-show="showNum" :class="['num', { red: index < 3 }]">
        {{ (index + 1) | addZero }}
      </i>
      <div class="left">
        <h5>{{ item.name }}</h5>
        <p>
          <i v-show="item.song.privilege.playMaxbr == 999000" class="sq"></i>
          {{ item.song.artists[0].name }}-{{ item.name }}
        </p>
      </div>
      <div class="right">
        <a class="playBtn" 
           @click="$emit('play',item)"
           href="javaScript:void(0)"></a>
      </div>
    </li>
  </ul>
</template>
<script>
export default {
  name: "SongList",
  props: {
    songs: Array,
    showNum: {
      type: Boolean,
      default: false,
    },
  },
  methods: {},
  filters: {
    addZero(val) {
      return val < 10 ? "0" + val : val;
    },
  },
};
</script>
<style lang="less" scoped>
.songList {
  background-color: #fff;
  padding: 5px 10px;
  z-index: 10;
  li {
    display: flex;
    align-items: center;
    padding: 5px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    i.num {
      display: inline-block;
      width: 40px;
      font-size: 17px;
      line-height: 43px;
      font-style: normal;
    }
    i.red {
      color: #df3436;
    }
    .left {
      flex: 1;
      h5 {
        font-size: 17px;
        font-weight: 400;
      }
      p {
        font-size: 12px;
        color: #888;
        i.sq {
          display: inline-block;
          width: 13px;
          height: 12px;
          background: url(../assets/index_icon_2x.png) no-repeat;
          background-position: 0 0;
          background-size: 166px 97px;
          vertical-align: middle;
        }
      }
    }
    .right {
      width: 22px;
      height: 22px;
      .playBtn {
        display: inline-block;
        width: 22px;
        height: 22px;
        background: url(../assets/index_icon_2x.png) no-repeat;
        background-position: -24px 0;
        background-size: 166px 97px;
      }
    }
  }
}
</style>